<template>
  <div class="app-container">
    获取数据：
    <el-radio-group v-model="role">
      <el-radio-button label="pull"></el-radio-button>
      <el-radio-button label="push"></el-radio-button>
    </el-radio-group>
    <code v-model="lists">{{lists}}</code>
  </div>
</template>

<script>
  import { mapGetters } from 'vuex';
  import { getList } from 'api/test';
  export default{
    data() {
      return {
        role: '',
        lists: '123'
      }
    },
    computed: {
      ...mapGetters([
        'roles'
      ])
    },
    watch: {
      role(val) {
        getList().then(response => {
          this.lists = response.data;
        }).catch(err => {
          this.fetchSuccess = false;
          console.log(err);
        });
      }
    }
  }
</script>
